// CounterThread.cpp : implementation file
//

#include "stdafx.h"
#include "TestThread3.h"
#include "CounterThread.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCounterThread
extern int bESCPressed;
extern int nCount;

IMPLEMENT_DYNCREATE(CCounterThread, CWinThread)

CCounterThread::CCounterThread()
{
}

CCounterThread::~CCounterThread()
{
}

BOOL CCounterThread::InitInstance()
{
	// TODO:  perform and per-thread initialization here
	return TRUE;
}

int CCounterThread::ExitInstance()
{
	// TODO:  perform any per-thread cleanup here
	return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CCounterThread, CWinThread)
	//{{AFX_MSG_MAP(CCounterThread)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCounterThread message handlers

int CCounterThread::Run() 
{
	// TODO: Add your specialized code here and/or call the base class
	while (!bESCPressed) {
                   nCount++;
                   Sleep(100);
          }

	return CWinThread::Run();
}
